<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <?php echo $this->Html->charset(); ?>
        <title>
            <?php echo $title_for_layout; ?><?php echo Configure::read("Autoconfig.title"); ?>
        </title>
        <?php
        echo $this->Html->meta('icon');
        echo($this->Html->css("ksmolsztynek"));

        Optimiser::addJavascriptLibrary("js/jquery.min.js");
        Optimiser::addJavascriptLibrary("js/jquery.corner.js");
        //$tms = microtime(true);
        Optimiser::addJavascriptCode($this->element('chatbox/script'));
        Optimiser::addJavascriptFile('js/dropdown-menu-script.js');
        if ($frontpage)
            Optimiser::addJavascriptFile('js/accordion-script.js');
//                $tm = (microtime(true)-$tms)*1000;
//echo("Time: ".$tm."ms.");
        echo Optimiser::saveJavascriptAndReturnHeadLink();
        echo Optimiser::saveCssAndReturnHeadLink();
        echo $scripts_for_layout;
        ?>
    </head>
    <body>
        <div id="header">
            <div id="menu">
                <ul class="topnav">
                    <?php
                    foreach (Configure::read("Autoconfig.top_menu") as $arr) {
                        echo("<li>");

                        if ($arr['url'] == null) {
                            echo('<a class="no-hover">' . $arr['title'] . '</a>');
                        } else {
                            echo('<a class="hovered" href="' . $arr['url'] . '">' . $arr['title'] . '</a>');
                        }

                        if ($arr['has_children']) {
                            echo('<ul class="subnav">');

                            foreach ($arr['children'] as $subarr) {
                                echo('<li><a class="hovered" href="' . $subarr['url'] . '">' . $subarr['title'] . '</a></li>');
                            }

                            echo('</ul>');
                        }

                        echo("</li>");
                    }
                    ?>
                </ul>
            </div>
        </div>
        <div id="main">
            <?php if ($frontpage): ?>
                <?php echo $this->Session->flash(); ?>
                <?php echo $content_for_layout; ?>
            <?php else: ?>

                <table id="page"><tr>

                        <td style="width: 1%;">
                            <div id="menuleft">
                                <div class="item">
                                    <h3>Menu</h3>
                                    <ul>
                                        <li><a href="/">Strona główna</a></li>
                                        <?php
                                        if ($authorized && $authorizedAsAdmin) {
                                            echo('<li><a href="/admin">Panel administracyjny</a></li>');
                                        }
                                        ?>
                                    </ul>
                                    <hr />
                                    <?php
                                    echo $this->element('user_panel');
                                    ?>
                                    <hr />
                                    <h3>Chatbox</h3>
                                    <?php
                                    echo $this->element('chatbox/chatbox');
                                    ?>
                                </div>
                                <!--<div class="item">
                                        <h2>Shoutbox</h2>
                                        <jdoc:include type="modules" name="shoutbox" />
                                </div>-->
                            </div>
                        </td>


                        <td><div id="textdiv">
                                <?php echo $this->Session->flash(); ?>
                                <?php echo $content_for_layout; ?>
                            </div>
                        </td></tr></table>
                &nbsp;
                <div id="mainending">Zobacz też: <strong><a href="http://www.wolontariat.olsztynek650.pl/">Centrum Wolontariatu - Olsztynek</a></strong></div>
            <?php
            endif;
            ?>
        </div>
        <div id="buttons">
            <div id="emka" class="button">
                <h5><a href="http://www.emka.ksm.org.pl" target="_blank">Szkoła języków obcych eMKa</a></h5>
                <p>Istniejemy, by uczyć!</p>
                <a href="http://www.emka.ksm.org.pl" target="_blank"><img src="http://www.ksm.org.pl/images/6.jpg" width="250" height="118" alt="Szkoła języków obcych eMKa" /></a>
            </div><!-- #emka -->
            <div id="biuletyn-ksm" class="button">
                <h5><a href="http://www.ksm.org.pl/dla-czlonkow/biuletyn-ksm">Biuletyn KSM</a></h5>
                <p>Zapisz się, aby otrzymywać Biuletyn na skrzynkę e-mailową.</p>
                <a href="http://www.ksm.org.pl/dla-czlonkow/biuletyn-ksm"><img src="http://www.ksm.org.pl/images/55.jpg" width="228" height="109" alt="Heaven" /></a>
            </div><!-- #biuletyn-ksm -->
            <div id="sforum" class="button">
                <a href="http://www.forum.ksm.org.pl"><img src="http://www.ksm.org.pl/images/21.jpg" width="250" height="118" alt="" /></a>
            </div><!-- forum -->
            <div id="ksiegarnia" class="button">
                <a href="http://www.ksiegarnia-ksm.pl"><img src="http://www.ksm.org.pl/images/25.jpg" width="230" height="100" alt="Wydawnictwo i Księgarnia GOTÓW" /></a>
            </div><!-- forum -->
            <div id="wzrastanie" class="button">
                <a href="http://www.wzrastanie.pl"><img src="http://www.ksm.org.pl/images/29.jpg" width="230" height="100" alt="" /></a></div>
            <div id="stop-narkotykom" class="button">
                <a href="http://www.ksm.org.pl/dla-mediow/dlaczego-stop-narkotykom">
                    <img src="http://www.ksm.org.pl/images/26.jpg" width="230" height="100" alt="Dlaczego STOP narkotykom" /></a>
            </div><!-- forum -->
        </div><!-- #buttons -->
        <div id="footer">
            <?php echo Configure::read("Autoconfig.footer"); ?> 
        </div>
        <?php echo $this->element('sql_dump'); ?>
    </body>
</html>
